package com.example.demo.service.impl;

import com.example.demo.entity.HotSearchWord;
import com.example.demo.mapper.HotSearchWordMapper;
import com.example.demo.service.HotSearchWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HotSearchWordServiceImpl implements HotSearchWordService {
    private final HotSearchWordMapper hotSearchWordMapper;

    @Autowired
    public HotSearchWordServiceImpl(HotSearchWordMapper hotSearchWordMapper) {
        this.hotSearchWordMapper = hotSearchWordMapper;
    }

    @Override
    public List<String> findAll() {
        return hotSearchWordMapper.findAll().stream().map(HotSearchWord::getWord).toList();
    }
}
